//-----------------------------------------------------------------------
// <copyright file="ProductCatService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class ProductCatService
    {
        #region ProductCat

        public static void CreateProductCat(ProductCat productCat)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                productCatDAO.CreateProductCat(productCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateProductCatException, ex);
            }
        }        

        public static void UpdateProductCat(ProductCat productCat)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                productCatDAO.UpdateProductCat(productCat);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateProductCatException, ex);
            }
        }        

        public static void DeleteProductCat(long proCateID)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                productCatDAO.DeleteProductCat(proCateID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteProductCatException, ex);
            }
        }
        
        public static ProductCat GetProductCat(long proCateID)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                return productCatDAO.GetProductCat(proCateID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductCatException, ex);
            }
        }                

        public static ProductCatCollection GetProductCatList(ProductCatColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                return productCatDAO.GetProductCatList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductCatListException, ex);
            }
        }        

        public static ProductCatCollection GetProductCatList(ProductCatColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                return productCatDAO.GetProductCatList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductCatListException, ex);
            }
        }        

	    public static ProductCatCollection GetProductCatListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                return productCatDAO.GetProductCatListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductCatListException, ex);
            }
        }        

        public static ProductCatCollection GetProductCatListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                ProductCatDAO productCatDAO = new ProductCatDAO();
                return productCatDAO.GetProductCatListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductCatListException, ex);
            }
        }        

        #endregion
    }
}